#ifndef GS_STRING_H
#define GS_STRING_H

#include "include/IString.h"
#include "Managed.h"

namespace Gs
{
	// Represents a GorillaScript string.
	class String : public Managed, public IString
	{
	private:
		char *_buffer;
		unsigned int _size;
		unsigned int _hash;

	public:
		// Initialises a new instance of the string.
		String(const char *str = 0);

		// Initialises a new instance of the string.
		String(unsigned int size);

		// Destroys the instance.
		~String();

		// Gets a pointer to the C-string buffer.
		const char *GetCString() const;

		// Gets a pointer to the buffer.
		char *GetBuffer();

		// Gets the length of the string.
		int GetLength() const;

		// Gets the hash of the string.
		unsigned int GetHash() const;

		// Determines if the two strings are equal.
		bool IsEqual(String *string) const;

		// Determines if the string is a valid identifier.
		bool IsIdentifier() const;
	};
}

#endif